import Vue from "vue";
// 1. 引入VueRouter
import VueRouter from "vue-router";
import Home from "../pages/Home.vue";
import Classify from "../pages/Classify.vue";
import Cart from "../pages/Cart.vue";
import Mine from "../pages/Mine.vue";
import Login from "../pages/Login.vue";
import Reg from "../pages/Reg.vue";
import NotFound from "../pages/NotFound.vue";
import Detail from "../pages/Detail.vue";
// 2. 使用（安装）vue-router
Vue.use(VueRouter);
// 3. 实例化VueRouter并配置参数
const router=new VueRouter({
    routes:[{
        name:'home',
        path:'/home',
        component:Home
    },{
        name:'classify',
        path:'/classify',
        component:Classify
    },{
        name:'detail',
        path:'/detail/:id',
        component:Detail
    },{
        name:'login',
        path:'/login',
        component:Login
    },{
        name:'reg',
        path:'/reg',
        component:Reg
    },{
        name:'mine',
        path:'/mine',
        component:Mine
    },{
        name:'cart',
        path:'/cart',
        component:Cart
    },{
        path:'/',
        redirect:'/home'    
    },{
        name:'404',
        path:'*',
        component:NotFound
    }]
})
export default router;
